home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Objects / Server / LogoutUser.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  4.5 KB  |  163 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ******************* API **********************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   objectTag
  10. //
  11. // DESCRIPTION:
  12. //   This object is used as a shim to launch the appropriate 
  13. //   server behavior for the current server model.  The individual
  14. //   server behavior files are responsible for inserting the code on the
  15. //   page, so this function just returns the empty string.
  16. //
  17. // ARGUMENTS:
  18. //   none
  19. //
  20. // RETURNS:
  21. //   string - empty string to indicate that nothing should be inserted
  22. //--------------------------------------------------------------------
  23.  
  24. function objectTag() 
  25. {
  26.   var dom = dw.getDocumentDOM();
  27.   
  28.   if (dom)
  29.   {
  30.     var serverModel = dom.serverModel.getFolderName();
  31.     
  32.     if (serverModel)
  33.     {    
  34.       var serverBehaviorFile = "";
  35.  
  36.       switch (serverModel)
  37.       {
  38.       case "ASP_VBS":
  39.       case "ASP_JS":
  40.       case "JSP":
  41.       case "ColdFusion":
  42.         serverBehaviorFile = "Logout User.htm";        
  43.         break;
  44.  
  45.       case "PHP_MySQL":
  46.         serverBehaviorFile = "Log Out User.htm";
  47.         break;
  48.  
  49.       case "ASP.NET_Csharp":
  50.       case "ASP.NET_VB":
  51.         // not supported
  52.         break;
  53.  
  54.       default:
  55.         // We will launch a server behavior with a default name
  56.         // so that live objects can be implemented
  57.         // for third party server models.
  58.  
  59.         serverBehaviorFile = "LogoutUser.htm";        
  60.         break;
  61.       } 
  62.  
  63.       if (serverBehaviorFile && canInsertServerObject(serverBehaviorFile))
  64.       {
  65.         dw.popupServerBehavior(serverBehaviorFile);
  66.       }
  67.     }
  68.     else
  69.     {
  70.       alert(MM.MSG_NeedServerModelForSO);
  71.     }
  72.   }
  73.   
  74.   return "";  
  75. }
  76.  
  77.  
  78. //--------------------------------------------------------------------
  79. // FUNCTION:
  80. //   canInsertServerObject
  81. //
  82. // DESCRIPTION:
  83. //   The function returns true if this object can be inserted in the
  84. //   current document.  This function, and the functions it calls should
  85. //   display the necessary error messages.
  86. //
  87. // ARGUMENTS:
  88. //   sbFileName - string - the file name of the server behavior file
  89. //     which implements this object
  90. //
  91. // RETURNS:
  92. //   boolean - true if the dialog should be displayed, or false otherwise
  93. //--------------------------------------------------------------------
  94.  
  95. function canInsertServerObject(sbFileName)
  96. {
  97.   var retVal = true;
  98.  
  99.   var curDom = dw.getDocumentDOM();
  100.   var serverModel = (curDom) ? curDom.serverModel.getFolderName() : "";
  101.   var path = dw.getConfigurationPath() + "/ServerBehaviors/" + serverModel
  102.            + "/" + sbFileName;
  103.            
  104.   if (!dwscripts.fileExists(path))
  105.   {
  106.     var err = dwscripts.sprintf(MM.MSG_NeedCommandFileForSO, path);
  107.     retVal = false;
  108.     alert(err);
  109.   }
  110.   
  111.   return retVal;
  112. }
  113.  
  114. //--------------------------------------------------------------------
  115. // FUNCTION:
  116. //   getSetupSteps
  117. //
  118. // DESCRIPTION:
  119. //   Returns an array of steps to be displayed in an instructions
  120. //   dialog.  The first element of the array is the text that appears
  121. //   above the list.  The remaining elements are the steps, which will
  122. //   be rendered in a numbered list.
  123. //
  124. //   The steps are each HTML, which may contain JavaScript event
  125. //   handlers.  The event handlers can either be a JavaScript script
  126. //   or an "event:KeyWord" syntax.  If the latter is used, then the
  127. //   handler for KeyWord is implemented internally in the Dreamweaver
  128. //   executable.
  129. //
  130. // ARGUMENTS:
  131. //   none
  132. //
  133. // RETURNS:
  134. //   the array described above
  135. //--------------------------------------------------------------------
  136. function getSetupSteps()
  137. {
  138.   return getSetupStepsForServerObject(true,false);
  139. }
  140.  
  141.  
  142.  
  143. //--------------------------------------------------------------------
  144. // FUNCTION:
  145. //   setupStepsCompleted
  146. //
  147. // DESCRIPTION:
  148. //   Returns the number of steps (in the list of steps returned from
  149. //   getSetupSteps) that have already been completed.  This number is
  150. //   used to determine how many steps will have a check mark next to
  151. //   them.
  152. //
  153. // ARGUMENTS:
  154. //   none
  155. //
  156. // RETURNS:
  157. //   An integer - the number of check marks to be displayed, or -1
  158. //   if all steps have been completed.
  159. //--------------------------------------------------------------------
  160. function setupStepsCompleted()
  161. {
  162.   return setupStepsCompletedForServerObject(true);
  163. }